#!/usr/bin/python
# -*- coding:utf-8 -*-
# @author  : micah
# @time    : 2023/10/22 11:22
# @function: the script is used to do something.
# @version :

"""
在一个学校中有3个办公室，有8名来时等待分配办公室，随机分配
"""

import random

# 定义一个列表来存储3个办公室
offices = [[], [], []]

# 定义8名老师
teachers = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']

# 通过遍历的方式获取到所有的老师
for teacher in teachers:
    # 生成随机下标获取随机的办公室
    random_num = random.randint(0, 2)
    # 根据随机下标获取办公室，通过这个办公室去添加老师
    offices[random_num].append(teacher)

i = 1
for office_teachers in offices:
    print(f'办公室{i}的人数为{len(office_teachers)}')
    i += 1

    for name in office_teachers:
        print(f'{name}', end='')
    print('\n')
    print('-' * 20)
